#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 装饰器

from time import time, sleep
from functools import wraps

def timer(func):
    @wraps(func)
    def wrapper(*args, **kw):
        start = time()
        f = func(*args, **kw)
        end = time()
        print("time run %f second" % (end - start))
        return f
    return wrapper

@timer
def run_fun(n):
    sleep(n)
    print('done')


run_fun(4)